import {IOptions, Popup} from "@/components/FormDialog/popup/popup";

import {ref} from 'vue'
import * as warehouseApi from '@/api/warehouse.api'

export async function WarehouseSelect(options:IOptions) {

    const columns = ref([])
    //获取仓库信息
    var list = await warehouseApi.getList({pageNum: 1, pageSize: 100}).then(res => res.data)
    console.log('得到的数据是', list,)
    columns.value = list.map(item => {
        item.label = item.name
        return item
    })
    console.log('添加一个 label 到list ',columns.value )
    return Popup({
        data() {
            return {
                columns: columns.value
            }
        },
        success(result){
            options.success(result)
        }
    })
}
